// ****************** TV room *******************************

// m here = minute = 60 * second
// h here = hour   = 60 * minute
// K               = 1000
// KK works as 10^6
// s here = second = 1000


// ******** infrastructure *************

Analog.NBits                 =    12   // 8, 10, 12, or 13
Analog.ReadAveraging         =     1   // 1(1)32
Board.BatteryDivider         =     0.0824
Board.LoggingToUSD           =     0
Board.SendingToBase          =     1  
Board.msBlinkLength          =   200
Board.msMaxInactivity        =    30s
Board.Name                   =   'TV room'
Board.Nominal3V3             =     3.304  // for fudging analog read
Board.Tag                    =   'T'
DS1307.msJogDelay            =     6s // ******** not checked ***********
FileSystem.NewFileNameQDay   =     1
XBee.BaseID                  =   200
XBee.BaudRate                = 38400

// ********* sensors ******************

ACDetect_1.InUse       =  0
ACDetect_2.InUse       =  0
BMP085.InUse           =  1      // OK needed
depth.InUse            =  1      // NG, needed
DHT22_1.InUse          =  1      // pond needed
DHT22_2.InUse          =  1      // outside needed
lightning.InUse        =  0 
relay_1.InUse          =  1      // waterfall needed 
resistance_1.InUse     =  1      // light needed
resistance_2.InUse     =  0
resistance_3.InUse     =  0 
SPS30.InUse            =  0     
switch_1.InUse         =  0 
switch_2.InUse         =  0 
VC0706.InUse           =  0
voltage_1.InUse        =  1      // OK needed  
voltage_2.InUse        =  1      // OK needed

ACDetect_2.SensorTag   =  'A'
BMP085.SensorTag       =  'B'
DHT22_2.SensorTag      =  'D'
depth.SensorTag        =  'd'
DHT22_1.SensorTag      =  'E'
ACDetect_1.SensorTag   =  'F'
resistance_1.SensorTag =  'L'
voltage_1.SensorTag    =  'P'
voltage_2.SensorTag    =  'p'
switch_2.SensorTag     =  'R'
SPS30.SensorTag        =  'S'
relay_1.SensorTag      =  'T'
switch_1.SensorTag     =  'W'
resistance_3.SensorTag =  'w'
lightning.SensorTag    =  'Z'

// ---- pressure

BMP085.Observed                      =  'outside'
BMP085.usNominalReadInterval         =    3mK
BMP085.msNominalReportInterval       =   20m
BMP085.MaxPressureInches             =   35
BMP085.MinPressureInches             =   22
BMP085.MaxTempC                      =   50
BMP085.MinTempC                      =  -40
BMP085.ReportTemp                    =    0


// ----    pond depth

depth.Damping                        =    0.9
depth.DepthInchesDry                 =    1   // min depth
depth.DepthInchesWet                 =   10   // max depth
depth.LowerOhms                      =   10K
depth.msCurrentDuration              =   30s
depth.ProbeOhmsDry                   =   22K
depth.ProbeOhmsWet                   =   10K
depth.UpperOhms                      =   10K
depth.usNominalReadInterval          =   10sK
depth.msNominalReportInterval        =   10m

// ----   pond temp

DHT22_1.Observed                     =  'pond'
DHT22_1.MaxTempC                     =   50
DHT22_1.MinTempC                     =  -40
DHT22_1.usNominalReadInterval        =   2hK
DHT22_1.ReportRH                     =    0

// ----  outside temp & RH

DHT22_2.Damping                      =    0.9
DHT22_2.Observed                     =  'outside'
DHT22_2.MaxTempC                     =   50
DHT22_2.MinTempC                     =  -40
DHT22_2.usNominalReadInterval        =   10mK
DHT22_2.ReportRH                     =    1
DHT22_2.Singleton                    =    0

// ----waterfall

relay_1.usNominalReadInterval        =   15sK
relay_1.msNominalReportInterval      =    5m
relay_1.FollowSwitch                 =    0
relay_1.Cycler                       =    1
relay_1.Thermostat                   =    0
relay_1.msMinimumHold                =    1m

relay_1.OnTime                       = 0700
relay_1.OffTime                      = 0500
relay_1.Singleton                    =    1

// ----  light

resistance_1.Damping                 =    0.9
resistance_1.Light                   =    1
resistance_1.Light100                =    0.93
resistance_1.Light000                =    0.09
resistance_1.msNominalReportInterval =   10m
resistance_1.Observed                = 'light'
resistance_1.UpperOhms               =   4.7K
resistance_1.usNominalReadInterval   =    1mK
resistance_1.WindDirection           =    0

// ----   left power

voltage_1.Battery                    =  0       // ******** not checked ***********
voltage_1.DividerRatio               =  0.599
voltage_1.MultiplyBy                 =  20.6897
voltage_1.Observed                   = 'power left'
voltage_1.WildInput                  =  1
voltage_1.ProtectionDiodeDrop        =  0.504   // varies with voltage, 0.44-0.50
voltage_1.ThenAdd                    = -0.3690
voltage_1.usNominalReadInterval      = 10mK

// ----  right power

voltage_2.Battery                    =  0
voltage_2.DividerRatio               =  0.597 
voltage_2.MultiplyBy                 =  21.673
voltage_2.Observed                   = 'power right'
voltage_2.WildInput                  =  1
voltage_2.ProtectionDiodeDrop        =  0.506    
voltage_2.ThenAdd                    = -0.1715
voltage_2.usNominalReadInterval      = 10mK
